Cmpt 441-711: Homework 2 Question 6.22
نویسنده
چکیده
Denote by Sk the set of floors that can be reached from floor 32 in k, but not in k − 1, steps. Then, obviously, S0 = 32. Now we give description of the algorithm for computing Sk, for any k > 0, assuming that all S0, S1, . . . , Sk−1 have been computed. From the definition of Sk it follows that any element x of Sk was reached from at least one of x − 11, where x − 11 ∈ Sk−1 and x + 6, where x + 6 ∈ Sk−1. Also, if some element y ∈ {1, . . . , 50} belongs to any of S0, S1, . . . , Sk−1, then y / ∈ Sk (as shorter path from 32 to y has already been found). Therefore, in order to compute Sk, we iterate through all y ∈ {1, . . . , 50} and for each of the y that does not belong to any of S0, S1, . . . , Sk−1 we check if any of y− 11 and y + 6 belongs to Sk−1. If it does, then we add y to Sk. In the case that some of Sj remains empty after this procedure then either the shortest paths to all of the floors have been found or there are some floors that can not be reached using the given operations. In this problem this can not happen as 11 and 6 are relatively prime (so path from i to j exists for any pair of floors), but for example in the case when we can only go 10 floors up and 5 floors down it is impossible to reach floor 33 starting from floor 32. It can be easily computed that S14 is the Sk containing 33, hence the answer to the first question is: we have to press an elevator’s button at least 14 times in order to get from floor 32 to floor 33. Using simple backtracking it can be found that, in total, we have to go 5 times up and 9 times down in order to reach floor 33. For the second part of the question, we first prove that in this case the answer to the first question (where 5 · 11 + 9 · 6 = 109 floors are visited) gives the answer to the second question as well. Assume on contrary that there exists another path where lower number of floors is visited. It implies that we have to take less than 9 button presses down or less than 5 button presses up (if none of these two is true than we end up with solution requiring at least 5 · 11 + 9 · 6 = 109 floors to be passed on our way). But, if we take less than 9 button presses down then, in total, we will pass by less than 9 · 6 = 54 floors down, implying that we will pass by less than 55 floors up. This further implies that we have less than 55 11 = 5 up button presses. This gives us solution where less than 9 + 5 = 14 button presses have been used, contradicting first part where we showed that 14 is the least number of button presses we need. The case when less than 5 button presses up are used is handled in analogous way. Therefore, our assumption is wrong and we conclude that the shortest time to go from 32 to 33 requires passing 109 floors.
منابع مشابه
Optimizing Partial Credit Algorithms to Predict Student Performance
As adaptive tutoring systems grow increasingly popular for the completion of classwork and homework, it is crucial to assess the manner in which students are scored within these platforms. The majority of systems, including ASSISTments, return the binary correctness of a student’s first attempt at solving each problem. Yet for many teachers, partial credit is a valuable practice when common wro...
متن کاملCSE 505 Assignment 2 Solution and Grading Guide
Like homework 1, homework 2 is graded out of 30 points. Overall, question 1 was worth 10 points, and question 2 (which had more parts and more proofs) 20. Question (2f) was worth 5, which seemed reasonable to me. Whether you think of question (2f) as extra credit is purely a matter of perspective; I chose to mark it as part of the 30 points possible, but if you want to think of it as true extra...
متن کاملPolylactide conjugates of camptothecin with different drug release abilities.
Camptothecin-polylactide conjugates (CMPT-PLA) were synthesized by covalent incorporation of CMPT into PLA of different microstructure, i.e., atactic PLA and atactic-block-isotactically enriched PLA (Pm = 0.79) via urethane bonds. The kinetic release of CPMT from CMPT-PLA conjugates, tested in vitro under different conditions, is possible in both cases and notably, strongly dependent on PLA mic...
متن کاملOn Distributed Concurrent Multi-Port Router Test System
This paper presents a framework of the distributed concurrent multi-port-testing test system (CMPT-TS) for IP routers under development at Sichuan Network Communication Key Laboratory. Having analyzed the actuality of concurrent testing for routers, this paper develops a distributed architecture of CMPT-TS and discusses its functional components in detail. Moreover, a new test definition langua...
متن کاملEcon 711 Homework 8 Solutions
u(h(xG)) = πHu(f(xG)) + (1− πH)u(xG) > πHu(mB) + (1− πH)u(mG) . Thus IRH is satisfied. IRL binds by the definition of f. ICH binds by the definition of h. Finally, ICL is satisfied since the utility of full insurance is the same for both high and low types, so u(h(xG)) = πHu(f(xG)) + (1− πH)u(xG) < πLu(f(xG)) + (1− πL)u(xG) since the payoff in the good state is higher than the payoff in the bad...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2014